﻿package mortal.game.resource.tableConfig
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.game.view.common.*;

    public class DrugBackConfig extends Object
    {
        private var _drugRecoverDic:Dictionary;
        private static var _instance:DrugBackConfig;

        public function DrugBackConfig()
        {
            this._drugRecoverDic = new Dictionary();
            if (_instance != null)
            {
                throw new Error(" DrugBackConfig 单例 ");
            }
            this.init();
            return;
        }// end function

        private function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_drug_bag_recovery.json");
            this.write(_loc_1);
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:TDrugBagRecovery = null;
            var _loc_3:Object = null;
            for each (_loc_3 in param1)
            {
                
                _loc_2 = new TDrugBagRecovery();
                ClassTypesUtil.copyValue(_loc_2, _loc_3);
                if (this._drugRecoverDic[_loc_2.type] == null)
                {
                    this._drugRecoverDic[_loc_2.type] = new Dictionary();
                }
                this._drugRecoverDic[_loc_2.type][int(_loc_2.level / 10)] = _loc_2;
            }
            return;
        }// end function

        public function getDrugRecoverDicByType(param1:int) : Dictionary
        {
            return this._drugRecoverDic[param1] as Dictionary;
        }// end function

        public static function get instance() : DrugBackConfig
        {
            if (_instance == null)
            {
                _instance = new DrugBackConfig;
            }
            return _instance;
        }// end function

    }
}
